//
//  SouFunXFListController.m
//  SouFunXFAPP
//
//  Created by 许博 on 16/5/18.
//  Copyright © 2016年 许博. All rights reserved.
//

#import "SouFunXFListController.h"
#import "CTMediator+SouFunJRAPP.h"


#import "UIImageView+WebCache.h"


@interface SouFunXFListController () <UITableViewDelegate,UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property (nonatomic,strong) NSArray *dataSource;
@end

@implementation SouFunXFListController


- (NSArray *)dataSource {
    if (_dataSource==nil) {
        _dataSource = @[
                        @{@"num1":@"1",@"num2":@"2"},
                        @{@"num1":@"3",@"num2":@"4"},
                        @{@"num1":@"5",@"num2":@"6"},
                        @{@"num1":@"7",@"num2":@"8"},
                        @{@"num1":@"9",@"num2":@"10"}
                        ];
    }
    return _dataSource;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.tableView.delegate = self;
    self.tableView.dataSource =self;
    self.tableView.rowHeight = 80;
    

}



- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 5;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *ID = @"cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell==nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
    }
    cell.textLabel.text = @"新房列表";
    cell.imageView.image = [UIImage imageNamed:@"newhouse"];
    NSURL *url = [NSURL URLWithString:@"http://img.soufun.com/viewimage/house/2014_11/17/bj/1416190704832_000/160x120.jpg"];
    [cell.imageView sd_setImageWithURL:url];
    return cell;
}

- (instancetype)initWithControllerName:(NSString *)controllerName {
    if (self = [super init]) {
        _controllerName = controllerName;
    }
    return self;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    NSString *num1 = [self.dataSource[indexPath.row] valueForKey:@"num1"];
    NSString *num2 = [self.dataSource[indexPath.row] valueForKey:@"num2"];
    [[CTMediator sharedInstance] SouFunMediator_presentResultWithNum1:num1 Num2:num2];
    
    
}

@end
